package com.example.demoamqp.receiver;

import cn.hutool.core.date.DateUtil;
import com.example.demoamqp.conatants.Constants;
import com.example.demoamqp.entity.Order;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 测试MQ 点对点模式
 * 消费者
 *
 * 1个生产者多个消费者
 *
 * @className: MqReceiver
 * @projectName: demo-one
 * @auth: rosszhang
 * @date: 2023/12/28 14:39
 */
@Slf4j
@Component
public class MqSimpleReceiver {

    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void workAQueueOrder(Order order) {
        log.info("[消费者A：{}----消费---订单：{}]", DateUtil.date(), order);
    }

    @RabbitListener(queues = Constants.WORK_QUEUE)
    public void workBQueueOrder(Order order) {
        log.info("[消费者B：{}----消费---订单：{}]", DateUtil.date(), order);
    }

}
